import { Model } from 'dva';
import Service from '@/public/http/services';
export default {
    namespace: 'business_dirctor',
    state: {
        list: [],
        total: 0,
         selectlist: []
    },
    effects: {
        *fetchList({ payload }, { put, call }) {
            const result = yield call(Service.queryWorkTreasureBox, payload);
          const result2 = yield call(Service.queryWorkselect, {mtype:4});
          var j:any;
          var json={};
          for(j in result2) {
            json[result2[j].moduleId] = result2[j].moduleName;
          }
          yield put({ type: 'setList', payload: [result,json] });
        },
    },
    reducers: {
      setList(state, { payload: [{ list, pageCount },r2] }: any) {
        state.list = list;
        state.total = pageCount;
        state.selectlist = r2;
        return state;
      }
    },
} as Model

